package com.zpark.cloud.alibaba.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.Mapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @PackageName: com.zpark.cloud.alibaba.controller
 * @ClassName: NacosConfigController
 * @Description:
 * @author: RZS
 * @date: 2023/6/19  9:06
 */
@RestController
@RequestMapping("/config")
// 配置发布之后，动态刷新配置
@RefreshScope
public class NacosConfigController {

    @Value("${config.info}")
    private String info;
    @Value("${spring.application.name}")
    private String serverName;
    @Value("${server.port}")
    private String serverPort;

    @GetMapping("/info")
    public String info(){
        return "<h1>访问的服务名字："+serverName+"，访问服务端口号："+serverPort+"，配置中心配置信息："+info+"</h1>";
    }
}
